package code.structure.module.configs
{
	import code.main.core.mvc.YModelData;
	import code.structure.module.configs.cmd.AnalysisArea;
	import code.structure.module.configs.cmd.AnalysisGreenHouse;
	import code.structure.module.configs.cmd.AnalysisHonor;
	import code.structure.module.configs.cmd.AnalysisItem;
	import code.structure.module.configs.cmd.AnalysisLevel;
	import code.structure.module.configs.cmd.AnalysisSignIn;
	import code.structure.module.configs.cmd.AnalysisTask;
	import code.structure.module.configs.data.ItemConfigData;
	import code.structure.module.task.data.TaskTestConfig;
	
	/**
	 *配置表信息
	 * @author Yuri
	 *
	 */
	public class ConfigModel extends YModelData
	{
		
		public var analysisItem:AnalysisItem;
		public var analysisLevel:AnalysisLevel;
		public var analysisArea:AnalysisArea;
		public var analysisTask:AnalysisTask;
		public var analysisHonor:AnalysisHonor;
		public var analysisSignIn:AnalysisSignIn;
		public var analysisGreenHouse:AnalysisGreenHouse;
		
		public function ConfigModel()
		{
			super();
		}
		/**
		 *解析配置表信息 
		 * @param obj
		 * 
		 */
		public function analySystemData(obj:Object=null):Boolean{
			if(!obj) return false;
			//物品表解析
			analysisItem = new AnalysisItem();
			analysisItem.parserData(obj.item,obj.productItem);
			//等级表解析
			analysisLevel = new AnalysisLevel();
			analysisLevel.parserData(obj.level_info);
			//地块表解析
			analysisArea = new AnalysisArea();
			analysisArea.parserData(obj.area);
			//任务表解析
			//analysisTask = new AnalysisTask(obj.task, obj.subTask, this);
			analysisTask = new AnalysisTask(TaskTestConfig.config, TaskTestConfig.subConfig, this);
			//成就表解析
			analysisHonor = new AnalysisHonor(obj.honor, this);
			//签到表解析
			analysisSignIn = new AnalysisSignIn(obj.sign,this);
			//花房表解析
			analysisGreenHouse = new AnalysisGreenHouse(obj.greenhouse,this);
			return true;
		}
		
		public function getItemConfigData(id:int):ItemConfigData
		{
			return analysisItem.getItemConfigDataById(id);
		}
	}
}